package com.zimin.cloud.user.mapper;

import com.zimin.cloud.mine.pojo.user.view.UserRoleVO;
import com.zimin.cloud.user.pojo.entity.UserRole;
import com.zimin.mapper.injector.InjectBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户角色关联表 Mapper 接口
 * </p>
 *
 * @author zimin
 * @since 2022-06-14 15:59
 */
public interface UserRoleMapper extends InjectBaseMapper<UserRole> {

    @Select("select * from mine_user_role ur " +
            "left join mine_auth_role ar on ur.roleId = ar.id " +
            "where ur.userId = #{userId}}")
    List<UserRoleVO> getUseRoleByUserId(@Param(value = "userId") String userId);
}
